/*
* pyy Inc.
* Copyright (c) 2019 All Rights Reserved.
* create by pengyangyan
* date:2019-02-28
*/
package com.cqjtu.platform.controller;

import com.cqjtu.platform.entity.Role;
import com.cqjtu.platform.service.RoleService;
import io.swagger.annotations.Api;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;


import java.util.Date;



/**
 * Role 控制器
 * 
 * @author pengyangyan
 * Date: 2019-02-28 11:15:59
 */
@Api(description = "角色信息接口")
@Controller
@RequestMapping(value = "api/role")
public class RoleController extends BaseController<RoleService, Role,Integer>{

    @Override
    @RequiresPermissions("role:add")
    public ResponseEntity<Role> save(@RequestBody Role entity) {
        entity.setCreateDatetime(new Date());
        entity.setUpdateDatetime(new Date());
        return super.save(entity);
    }

    @Override
    @RequiresPermissions("role:update")
    public ResponseEntity<Role> update(@RequestBody Role entity) {
        entity.setUpdateDatetime(new Date());
        return super.update(entity);
    }
}
